home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr13 / aurora2c.zip / TABS.AML < prev    next >
Text File  |  1995-04-07  |  1KB  |  54 lines

  1.  
  2. // ───────────────────────────────────────────────────────────────────
  3. // The Aurora Editor v2.0
  4. // Copyright 1993-1995 nuText Systems. All Rights Reserved Worldwide.
  5. //
  6. // Detab (tab expansion) and Entab (tab compression) macro
  7. //
  8. // Converts tabs to spaces in the current file (detab), or converts
  9. // spaces to tabs (entab) The conversion is limited to a marked block if
  10. // it exists in the current file. The current value of the _TabWidth
  11. // configuration variable is used as the tab width.
  12. //
  13. // (Note: this macro will run faster if undo is disabled)
  14. // ───────────────────────────────────────────────────────────────────
  15.  
  16.   // compile time macros and function definitions
  17.   include  bootpath "define.aml"
  18.  
  19.   if not objtype? "edit" then
  20.     msgbox "Edit windows only!"
  21.     return
  22.   end
  23.  
  24.   // mark beginning of undoable group
  25.   undobegin
  26.  
  27.   // test for mark in current window
  28.   if mark? then
  29.     if getmarkbuf <> getcurrbuf then
  30.       msgbox "Block not marked in current window"
  31.       return
  32.     end
  33.   // create temp mark covering the entire file
  34.   else
  35.     markline 1 (getlines)
  36.     temp_mark = TRUE
  37.   end
  38.  
  39.   // check if entab was specified
  40.   entab = (arg 2) == 'e'
  41.  
  42.   // use built-in tabblock function for both detab and entab
  43.   tabblock (if? entab -_TabWidth _TabWidth)
  44.   if temp_mark then
  45.     destroymark
  46.   end
  47.  
  48.   undoend
  49.  
  50.   display
  51.   say  (if? entab "Entab " "Detab ") +
  52.        (if? not temp_mark "block ") + "done."
  53.  
  54.